home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 15
/
Aminet 15 - Nov 1996.iso
/
Aminet
/
dev
/
gcc
/
ixemsdk.lha
/
man
/
cat3
/
newctime.0
< prev
next >
Wrap
Text File
|
1996-09-02
|
7KB
|
199 lines
NEWCTIME(3) NEWCTIME(3)
NNAAMMEE
asctime, ctime, difftime, gmtime, localtime, mktime - con-
vert date and time to ASCII
SSYYNNOOPPSSIISS
eexxtteerrnn cchhaarr **ttzznnaammee[[22]];;
vvooiidd ttzzsseett(())
##iinncclluuddee <<ssyyss//ttyyppeess..hh>>
cchhaarr **ccttiimmee((cclloocckk))
ccoonnsstt ttiimmee__tt **cclloocckk;;
ddoouubbllee ddiiffffttiimmee((ttiimmee11,, ttiimmee00))
ttiimmee__tt ttiimmee11;;
ttiimmee__tt ttiimmee00;;
##iinncclluuddee <<ttiimmee..hh>>
cchhaarr **aassccttiimmee((ttmm))
ccoonnsstt ssttrruucctt ttmm **ttmm;;
ssttrruucctt ttmm **llooccaallttiimmee((cclloocckk))
ccoonnsstt ttiimmee__tt **cclloocckk;;
ssttrruucctt ttmm **ggmmttiimmee((cclloocckk))
ccoonnsstt ttiimmee__tt **cclloocckk;;
ttiimmee__tt mmkkttiimmee((ttmm))
ssttrruucctt ttmm **ttmm;;
cccc ...... --llzz
DDEESSCCRRIIPPTTIIOONN
_C_t_i_m_e converts a long integer, pointed to by _c_l_o_c_k, repre-
senting the time in seconds since 00:00:00 UTC, January 1,
1970, and returns a pointer to a 26-character string of
the form
Thu Nov 24 18:22:48 1986\n\0
All the fields have constant width.
_L_o_c_a_l_t_i_m_e and _g_m_t_i_m_e return pointers to ``tm'' structures,
described below. _L_o_c_a_l_t_i_m_e corrects for the time zone and
any time zone adjustments (such as Daylight Saving Time in
the U.S.A.). After filling in the ``tm'' structure,
_l_o_c_a_l_t_i_m_e sets the ttmm__iissddsstt'th element of ttzznnaammee to a
pointer to an ASCII string that's the time zone abbrevia-
tion to be used with _l_o_c_a_l_t_i_m_e's return value.
_G_m_t_i_m_e converts to Coordinated Universal Time.
_A_s_c_t_i_m_e converts a time value contained in a ``tm'' struc-
ture to a 26-character string, as shown in the above
1
NEWCTIME(3) NEWCTIME(3)
example, and returns a pointer to the string.
_M_k_t_i_m_e converts the broken-down time, expressed as local
time, in the structure pointed to by _t_m into a calendar
time value with the same encoding as that of the values
returned by the _t_i_m_e function. The original values of the
ttmm__wwddaayy and ttmm__yyddaayy components of the structure are
ignored, and the original values of the other components
are not restricted to their normal ranges. (A positive or
zero value for ttmm__iissddsstt causes _m_k_t_i_m_e to presume initially
that summer time (for example, Daylight Saving Time in the
U.S.A.) respectively, is or is not in effect for the
specified time. A negative value for ttmm__iissddsstt causes the
_m_k_t_i_m_e function to attempt to divine whether summer time
is in effect for the specified time.) On successful com-
pletion, the values of the ttmm__wwddaayy and ttmm__yyddaayy components
of the structure are set appropriately, and the other com-
ponents are set to represent the specified calendar time,
but with their values forced to their normal ranges; the
final value of ttmm__mmddaayy is not set until ttmm__mmoonn and ttmm__yyeeaarr
are determined. _M_k_t_i_m_e returns the specified calendar
time; If the calendar time cannot be represented, it
returns --11.
_D_i_f_f_t_i_m_e returns the difference between two calendar
times, (_t_i_m_e_1 - _t_i_m_e_0), expressed in seconds.
Declarations of all the functions and externals, and the
``tm'' structure, are in the <<ttiimmee..hh>> header file. The
structure (of type) ssttrruucctt ttmm includes the following
fields:
int tm_sec; /* seconds (0 - 60) */
int tm_min; /* minutes (0 - 59) */
int tm_hour; /* hours (0 - 23) */
int tm_mday; /* day of month (1 - 31) */
int tm_mon; /* month of year (0 - 11) */
int tm_year; /* year - 1900 */
int tm_wday; /* day of week (Sunday = 0) */
int tm_yday; /* day of year (0 - 365) */
int tm_isdst; /* is summer time in effect? */
char *tm_zone; /* abbreviation of timezone name */
long tm_gmtoff; /* offset from UTC in seconds */
The _t_m___z_o_n_e and _t_m___g_m_t_o_f_f fields exist, and are filled in,
only if arrangements to do so were made when the library
containing these functions was created. There is no guar-
antee that these fields will continue to exist in this
form in future releases of this code.
_T_m___i_s_d_s_t is non-zero if summer time is in effect.
_T_m___g_m_t_o_f_f is the offset (in seconds) of the time repre-
sented from UTC, with positive values indicating east of
2
NEWCTIME(3) NEWCTIME(3)
the Prime Meridian.
FFIILLEESS
/usr/local/etc/zoneinfo time zone information
directory
/usr/local/etc/zoneinfo/localtime local time zone file
/usr/local/etc/zoneinfo/posixrules used with POSIX-style
TZ's
/usr/local/etc/zoneinfo/GMT for UTC leap seconds
If //uussrr//llooccaall//eettcc//zzoonneeiinnffoo//GGMMTT is absent, UTC leap seconds
are loaded from //uussrr//llooccaall//eettcc//zzoonneeiinnffoo//ppoossiixxrruulleess.
SSEEEE AALLSSOO
getenv(3), newstrftime(3), newtzset(3), time(2), tzfile(5)
NNOOTTEESS
The return values point to static data; the data is over-
written by each call. The ttmm__zzoonnee field of a returned
ssttrruucctt ttmm points to a static array of characters, which
will also be overwritten at the next call (and by calls to
_t_z_s_e_t).
Avoid using out-of-range values with _m_k_t_i_m_e when setting
up lunch with promptness sticklers in Riyadh.
3